home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
007
/
boosters.arc
/
XWORDS.PAS
< prev
Wrap
Pascal/Delphi Source File
|
1985-11-14
|
1KB
|
49 lines
{$IBoDecl}
{$IStrip}
{$ICenter}
{$IRword}
{$IWord}
{$IWords}
{$IWordInd}
{$ISpace}
var
Ts : AnyString;
j : Integer;
BEGIN
ClrScr;
Write( Center ( 'Type a message for analysis. Q to quit.',80,' '));
Write( Center ( '''n , string'' replaces word n of previous message'+
' with ''string''',80,' ') );
window (1,3,80,25);
repeat
readln( S );
S := space(S);
if Length(S) > 0 then
begin
val ( word(S,1), i, ecode );
if (ecode = 0) and (word(S,2) = ',') then
begin
j := WordInd (S, 3);
Ts := rword ( Ts , i, copy ( S, j, Length(S)-j+1) );
Writeln ( Ts );
end
else
begin
Ts := S;
Writeln ( S );
i := 1 + Random(Words(Ts));
end;
GotoXY( WordInd(Ts,i), WhereY );
writeln( #004 );
Writeln( 'There are ',words(Ts),' words in your message.');
Writeln('There are ',length(word(Ts,i)),' characters in word ',i);
end { Length > 0 };
until (S = 'Q') or (S = 'q');
window (1,1,80,25);
END.